package edu.ahut.designpattern.strategy;

public class BubbleSorter implements SortStrategy {
    @Override
    public void sort(int[] arr) {
        //具体的算法逻辑
        System.out.println(getClass().getName() + " is sorting arrays");
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }


    }
}
